package com.mycompany.myapplication;

import java.io.File;
import java.util.HashMap;
import java.util.Map;

import com.vaadin.server.FileResource;
import com.vaadin.server.VaadinService;
import com.vaadin.ui.Accordion;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Button;
import com.vaadin.ui.Component;
import com.vaadin.ui.HorizontalSplitPanel;
import com.vaadin.ui.Image;
import com.vaadin.ui.Label;
import com.vaadin.ui.MenuBar;
import com.vaadin.ui.Panel;
import com.vaadin.ui.TabSheet;
import com.vaadin.ui.Tree;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.VerticalSplitPanel;

public class MyLayout extends VerticalLayout {
	
	
	public MyLayout() {
		// TODO Auto-generated constructor stub
		addComponent(createMenuBar());
		
		Component panelImage = createPanelImage();
		addComponent(panelImage);
		setComponentAlignment(panelImage, Alignment.MIDDLE_CENTER);

	}

	

	private Component createMenuBar() {
		// TODO Auto-generated method stub
		MenuBar menuBar = new MenuBar();
		menuBar.setSizeFull();
		menuBar.addItem("File",null,null);
		menuBar.addItem("Cimitero",null,null);
		menuBar.addItem("Scadenze",null,null);
		menuBar.addItem("Stampe",null,null);
		menuBar.addItem("Anagrafiche",null,null);
		return menuBar;
	}

	
	private Component createPanelImage() {
		// TODO Auto-generated method stub
		@SuppressWarnings("unused")
		String basepath = VaadinService.getCurrent()
				.getBaseDirectory().getAbsolutePath();
		
		

		File file = new File(basepath +"/images/mainImage.png");
		System.out.println(file.exists());
		
		// Image as a file resource
		FileResource resource = new FileResource(file);
		return new Image("This is first image", resource);
		
	}

	


}
